//已读栏事件
$("#read").click(function(e) {
    if(this.checked){
		$("#rbutton").css("opacity","1");
		$("#rbutton span").css("color","#fff");
		$("#rbutton").css("background","#03F");
		$("#rbutton").css("cursor","pointer");
	}
	else if(!this.checked){
		$("#rbutton").css("opacity","0.5");
		$("#rbutton span").css("color","#666");
		$("#rbutton").css("background","#CCC");
		$("#rbutton").css("cursor","");
	}
});

//用户名栏事件
$("#userId").focusout(function(e) {
	var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
    if(reg.test($("#userId").val())){
		$("#uID1").css("display","none");
		$("#uID2").css("display","block");
	}else if($("#userId").val().length>20){
		$("#uID1").css("display","block");
		$("#uID2").css("display","none");
	}else{
		$("#uID1").css("display","none");
		$("#uID2").css("display","none");
	}
	if($("#userId").val().match(/^\s*$/)){
		$("#uID3").css("display","block");
		$("#uID1").css("display","none");
		$("#uID2").css("display","none");
	}else{
		$("#uID3").css("display","none");
		$("#uID1").css("display","none");
		$("#uID2").css("display","none");
	}
});

//再次输入用户名栏事件
$("#userId_second").focusout(function(e) {
    if($("#userId_second").val() != $("#userId").val()){
		$("#uIDS1").css("display","block");
	}else{
		$("#uIDS1").css("display","none");
	}
});

//电话栏事件
$("#phone").focusout(function(e) {
	if($("#phone").val().match(/^\s*$/)){
		$("#p1").css("display","block");
	}else if($("#phone").val().match(/^1(3|4|5|7|8)\d{9}$/)){
		$("#p1").css("display","none");
		$("#p2").css("display","none");
	}else{
		$("#p1").css("display","none");
		$("#p2").css("display","block");
	}
});
//身份证栏事件
$("#dlNo").focusout(function(e) {
	if($("#dlNo").val().match(/^\s*$/)){
		$("#dN1").css("display","block");
	}else if($("#dlNo").val().length == 18){
		$("#dN1").css("display","none");
		$("#dN2").css("display","none");
	}else{
		$("#dN1").css("display","none");
		$("#dN2").css("display","block");
	}
});
//驾驶证栏事件
$("#icNo").focusout(function(e) {
	if($("#icNo").val().match(/^\s*$/)){
		$("#iN1").css("display","block");
	}else if($("#icNo").val().length == 18){
		$("#iN1").css("display","none");
		$("#iN2").css("display","none");
	}else{
		$("#iN1").css("display","none");
		$("#iN2").css("display","block");
	}
});
//注册事检测事件
$("#rbutton").click(function(e) {
	var check = 0;
	if($("#read").is(":checked")){
		var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
    	if(reg.test($("#userId").val())){
			$("#uID2").css("display","block");
			$("#uID1").css("display","none");
		}
		if($("#userId").val().match(/^\s*$/)){
			$("#uID3").css("display","block");
			$("#uID1").css("display","none");
			$("#uID2").css("display","none");
		}
		if($("#uPassword").val().match(/^\s*$/)){
			$("#uP1").css("display","block");
		}else{
			$("#uP1").css("display","none");
		}
		if($("#name").val().match(/^\s*$/)){
			$("#n1").css("display","block");
		}else{
			$("#n1").css("display","none");
		}
		if($("#userId_second").val() != $("#userId").val()){
			$("#uIDS1").css("display","block");
		}else{
			$("#uIDS1").css("display","none");
		}
		if(reg.test($("#age").val())){
			$("#a1").css("display","block");
		}
		if($("#phone").val().match(/^\s*$/)){
			$("#p1").css("display","block");
		}
		if($("#icNo").val().match(/^\s*$/)){
			$("#iN1").css("display","block");
		}
		if($("#dlNo").val().match(/^\s*$/)){
			$("#dN1").css("display","block");
		}
		if($("#uID1").css("display") == "none" && 
		$("#uID2").css("display") == "none" &&
		$("#uID3").css("display") == "none" &&
		$("#uP1").css("display") == "none" &&
		$("#n1").css("display") == "none" &&
		$("#a1").css("display") == "none" &&
		$("#p1").css("display") == "none" &&
		$("#p2").css("display") == "none" &&
		$("#iN1").css("display") == "none" &&
		$("#iN2").css("display") == "none" &&
		$("#dN1").css("display") == "none" &&
		$("#dN2").css("display") == "none" &&
		$("#uIDS1").css("display") == "none"){
			$("#rb-list").submit();
		}
	}
});